export interface User {
  id: number
  username: string
  email: string
  displayName?: string
  avatar?: string
  isOnline: boolean
  lastSeenAt?: string
  createdAt: string
}

export interface AuthResponse {
  token: string
  user: User
  expiresAt: string
}

export interface LoginRequest {
  usernameOrEmail: string
  password: string
}

export interface RegisterRequest {
  username: string
  email: string
  password: string
  displayName?: string
}

export interface ChatRoom {
  id: number
  name: string
  description?: string
  type: ChatRoomType
  createdBy: number
  createdAt: string
  isActive: boolean
  members: User[]
  lastMessage?: Message
  unreadCount: number
}

export interface Message {
  id: number
  chatRoomId: number
  senderId: number
  content: string
  type: MessageType
  createdAt: string
  isEdited: boolean
  editedAt?: string
  sender?: User
}

export interface SendMessageRequest {
  chatRoomId: number
  content: string
  type: MessageType
}

export interface CreateChatRoomRequest {
  name: string
  description?: string
  type: ChatRoomType
  memberIds?: number[]
}

export interface ChatHistory {
  messages: Message[]
  totalCount: number
  pageNumber: number
  pageSize: number
  hasNextPage: boolean
}

export enum ChatRoomType {
  Direct = 1,
  Group = 2
}

export enum MessageType {
  Text = 1,
  Image = 2,
  File = 3,
  System = 4
}

export interface ApiResponse<T = any> {
  data?: T
  message?: string
  error?: string
}

export interface ChangePasswordRequest {
  currentPassword: string
  newPassword: string
}

export interface CreateDirectChatRequest {
  targetUserId: number
}

export interface EditMessageRequest {
  content: string
}

export interface UploadResult {
  url: string
  fileName: string
  size: number
}
